<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>form表单</title>
		<link rel="stylesheet" href="/adminSite/css/X-ui.css" />
		<link rel="stylesheet" href="/adminSite/css/article-xq.css" />
		<!--[if lt IE 9]>
			<script type="text/javascript" src="/adminSite/js/html5.js"></script>
		<![endif]-->
	</head>
	<body>
		<ol class="breadcrumb-nav">
			<li>
				<a href="">主页</a>
			</li>
			<li>
				文章列表
			</li>
		</ol>
		<div class="pd-20">
			<% if(article.length){%>
			<table class="table table-h table-border table-bg table-bordered mt-20">
				<thead>
					<tr>
						<th style="width:50px">序号</th>
						<th>标题</th>
						<th>发布时间</th>
						<th>作者</th>
						<th>栏目</th>
						<th>来源</th>
						<th>是否首页推荐</th>
						<th style="width:150px">操作</th>
					</tr>
				</thead>
				<tbody class="text-c">
						<% article.forEach(function(data , index){ %>
						<tr>
							<td><%= index+1 %></td>
							<td><%= data.title %></td>
							<td><%= ejsExtend.getDate(data.releaseTime) %></td>
							<td><%= data.author %></td>
							<td><%= data.column %></td>
							<td><%= data.source %></td>
							<td>
								<% if(data.Popular){ %> 是 <% }else{ %> 否 <% } %>
							</td>
							<td data-id="<%= data.id %>">
								<a href="">编辑</a>
								<a href="javascript:;" class="delete-btn">删除</a>
							</td>
						</tr>
						<% }) %>
				</tbody>
			</table>
			<% }else{ %>
				<h2 class="text-c">还未发布任何文章哦!</h2>
			<% } %>
		</div>
		<div class="pd-20">
			<a href="/admin/addArticle" class="btn">添加文章</a>
		</div>
	<script type="text/javascript" src="/adminSite/js/jquery-1.11.0.js" ></script>
	<script type="text/javascript" src="/adminSite/js/extend/X-ui-modal/js/X-ui-modal.js" ></script>
	<script>
		$(function(){
			$(".text-c .delete-btn").click(function(){
				var th = $(this)
				XuiModal().confirm("是否确定删除" , function(){
					var data = {id : th.parent("td").data("id")};
					$.post("/admin/remove" , data , function(data){
						if(data.state == "ok"){
							XuiModal().msg("删除成功" , {icon : 4} , function(){
								window.location.reload();
							});
						}else{
							XuiModal().msg(data.message , {icon : 2});
						};
					},"JSON");
				});
			});
		})
	</script>
	</body>
</html>
